package com.eco.fanliapp.admin.controller.web;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eco.fanliapp.admin.common.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.SyPageSetup;
import com.eco.fanliapp.service.ISyPageSetupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 页面设置开关 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2019-08-14
 */
@RestController
@RequestMapping("/web/syPageSetup")
public class SyPageSetupController extends BaseController {
    @Autowired
    private ISyPageSetupService iSyPageSetupService;


    @GetMapping(value = "syPageSetupList")
    public ServerResponse syPageSetupList(){
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("enable",1);
        queryWrapper.eq("deleted",0);
        List<SyPageSetup> syPageSetupList = iSyPageSetupService.list();
        return  ServerResponse.createBySuccess("查询成功",syPageSetupList);
    }
    @PostMapping(value = "syPageSetupUpdate")
    public ServerResponse syPageSetupUpdate(@RequestBody SyPageSetup syPageSetup){
        boolean update = iSyPageSetupService.updateById(syPageSetup);
        if(update) return  ServerResponse.createBySuccess("修改成功");
        return  ServerResponse.createByErrorMessage("修改失败");

    }
}
